package com.heatup.apt.common.dao;

import com.heatup.apt.model.TSysProvince;
import com.heatup.apt.model.TSysProvinceExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.session.RowBounds;
import org.springframework.stereotype.Component;

@Component
public interface TSysProvinceMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_sys_province
     *
     * @mbggenerated
     */
    int countByExample(TSysProvinceExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_sys_province
     *
     * @mbggenerated
     */
    int deleteByExample(TSysProvinceExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_sys_province
     *
     * @mbggenerated
     */
    @Delete({
        "delete from t_sys_province",
        "where province_ID = #{provinceId,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long provinceId);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_sys_province
     *
     * @mbggenerated
     */
    @Insert({
        "insert into t_sys_province (province_ID, province_name, ",
        "date_created, date_updated)",
        "values (#{provinceId,jdbcType=BIGINT}, #{provinceName,jdbcType=VARCHAR}, ",
        "#{dateCreated,jdbcType=TIMESTAMP}, #{dateUpdated,jdbcType=TIMESTAMP})"
    })
    int insert(TSysProvince record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_sys_province
     *
     * @mbggenerated
     */
    int insertSelective(TSysProvince record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_sys_province
     *
     * @mbggenerated
     */
    List<TSysProvince> selectByExampleWithRowbounds(TSysProvinceExample example, RowBounds rowBounds);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_sys_province
     *
     * @mbggenerated
     */
    List<TSysProvince> selectByExample(TSysProvinceExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_sys_province
     *
     * @mbggenerated
     */
    @Select({
        "select",
        "province_ID, province_name, date_created, date_updated",
        "from t_sys_province",
        "where province_ID = #{provinceId,jdbcType=BIGINT}"
    })
    @ResultMap("BaseResultMap")
    TSysProvince selectByPrimaryKey(Long provinceId);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_sys_province
     *
     * @mbggenerated
     */
    int updateByExampleSelective(@Param("record") TSysProvince record, @Param("example") TSysProvinceExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_sys_province
     *
     * @mbggenerated
     */
    int updateByExample(@Param("record") TSysProvince record, @Param("example") TSysProvinceExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_sys_province
     *
     * @mbggenerated
     */
    int updateByPrimaryKeySelective(TSysProvince record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_sys_province
     *
     * @mbggenerated
     */
    @Update({
        "update t_sys_province",
        "set province_name = #{provinceName,jdbcType=VARCHAR},",
          "date_created = #{dateCreated,jdbcType=TIMESTAMP},",
          "date_updated = #{dateUpdated,jdbcType=TIMESTAMP}",
        "where province_ID = #{provinceId,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(TSysProvince record);

    /**
     * 查询所有门店
     * @return
     */
    List<TSysProvince>  queryAllProvince();

    /**
     * 查找省ID
     * @param provinceName 省名称
     * @return
     */
    Long queryProvinceIdByName(String provinceName);

    /**
     * 查询省名称
     * @param provinceId 省ID
     * @return
     */
    String queryProvinceNameById(String provinceId);
}